import 'package:core_package/ui/widget/my_asset_image.dart';
import 'package:flutter/material.dart';
import 'package:core_package/core_package.dart';
import 'package:flutter_app_unionad/model/cash_detail_list_item.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

class WithdrawDepositOrderItemWidget extends StatelessWidget {
  final CashDetailListItem ?item;
   WithdrawDepositOrderItemWidget({Key ?key,this.item}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    String status;
    if(item!.status == 0){
      status = '审核中';
    }else if(item!.status == 1){
      status = '已完成';
    }else{
      status = '提现失败';

    }
    return Container(
        margin: EdgeInsets.only(bottom: 10.px),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(5.px),
        ),
        padding: EdgeInsets.only(
          left: 37.px,
          right: 20.px,
          top: 20.px,
          bottom: 20.px,
        ),
        child: Column(
          children: [
            builtItem(
              image: "icon_order_1",
              imageSize: Size(8, 12),
              title: "订单卡号",
              detail: item!.bankCardNumber,
            ),
            MySizeBox(height: 5),
            builtItem(
              image: "icon_order_2",
              imageSize: Size(10, 13),
              title: "提现类型",
              detail: item!.type==0?"推广金币提现":"合伙人提现",
            ),
            MySizeBox(height: 5),
            builtItem(
              image: "icon_order_3",
              imageSize: Size(10, 13),
              title: "提现金额",
              detail: "${item!.amount}元",
            ),
            MySizeBox(height: 5),
            builtItem(
              image: "icon_order_4",
              imageSize: Size(12, 12),
              title: "提现时间",
              detail: DateTime.fromMillisecondsSinceEpoch(item!.applyTime!).toString().split('.').first,
            ),
            MySizeBox(height: 5),
            builtItem(
              image: "icon_order_5",
              imageSize: Size(12, 12),
              title: "订单状态",
              detail: status,
              detailColor: MyColors.formHex("#4FD8FFFF"),
            ),
          ],
        ));
  }

  Widget builtItem({
    String ?image,
    String ?title,
    Size ?imageSize,
    String? detail,
    Color ?detailColor,
  }) {
    return Row(
      children: [
        Container(
          width: 13.px,
          alignment: Alignment.center,
          child: MyAssetImage(
            image??"",
            width: imageSize!.width.px,
            height: imageSize.height.px,
            fit: BoxFit.fill,
          ),
        ),
        MySizeBox(width: 15),
        Text(
          "$title：",
          style: TextStyle(
            color: MyColors.formHex("#1D242CFF"),
            fontSize: MyFont.font13,
            fontWeight: MyFontWeight.regular,
          ),
        ),
        Text(
          detail??"",
          style: TextStyle(
            decoration: detailColor != null ? TextDecoration.underline : TextDecoration.none,
            color: detailColor ?? MyColors.formHex("#1D242CFF"),
            fontSize: MyFont.font13,
            fontWeight: MyFontWeight.regular,
          ),
        )
      ],
    );
  }
}
